<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title>添加客户</title>
<script type="text/javascript">
//图片上传的初始化
	$('#uploadify').uploadify({
		'uploader' : 'uploadify/scripts/uploadify.swf',
		'script' : 'fileUploadfy', //指定服务端处理类的入口
		'method' :'GET',
		'folder' : 'upload/image',
		'cancelImg' : 'uploadify/cancel.png',
		'fileDataName' : 'uploadify', //和input的name属性值保持一致就好，Struts2就能处理了   
		'queueID' : 'fileQueue',
		'auto' : true,//是否选取文件后自动上传   
		'multi' : false,//是否支持多文件上传
		'simUploadLimit' : 1,//每次最大上传文件数   
		'fileDesc' : 'excel',//上传文件类型说明
		'fileExt' : '*.xlsx;*.xlsm;*.xltx;*.xltm;xlsa;*.xlsb;*.xlsk;*.xls',
		'scriptData'  :{'idid':$('#dealExcel_originId').val()},
		'wmode' : 'transparent', //隐藏进度条
		'displayData' : 'percentage',//有speed和percentage两种，一个显示速度，一个显示完成百分比    
		 'onSelect': function(event, queueID, fileObj) {
             $("#uploadify").uploadifySettings("scriptData", { "idid": $("#dealExcel_originId").val() }); //动态更新配(执行此处时可获得值)
         },
		'onComplete' : function(event, queueID, fileObj, response, data) {
			$("#filePath").val(response);
			$("#imgpath").html("<span>"+response+"<span>");
		}
	});

var checkMobile=function(){
	var mobile=$("#dealExcel_mobile").val();
	if(mobile==""){
		alert("电话不能为空！");
		return;
	}
	 $.ajax({
        type: 'post',
        url:'<%=basePath%>searchOrigin',
		data : {
			mobile : mobile
		},
		success : function(data) {
			var returnjson=eval('('+data+')');
			if(returnjson.success)
			{
				alertMsg.correct("验证成功！");
				$("#dealExcel_telphone").html(returnjson.data.telephone+"");
				$("#dealExcel_originName").html(returnjson.data.originName+"");
				$("#dealExcel_principalName").html(returnjson.data.principalName+"");
				$("#dealExcel_companyName").html(returnjson.data.companyName+"");
				$("#dealExcel_originId").val(returnjson.data.id+"");
				$("#dealExcel_checkMobile").hide();
				$("#dealExcle_originInfo").show();
				$("#dealExcel_inportExcel").show();
			}else{
				alertMsg.error(returnjson.message);
			}
		}
		});
}

</script>
</head>
<body>
	<div class="pageContent">
		<form class="pageForm required-validate" method="post" action="addCourierAction.action" onsubmit="return validateCallback(this, navTabAjaxDone);">
			<input type="hidden" name="rightId" value="${rightId}" />
			<div class="pageFormContent" layoutH="56">
				<div id="dealExcel_checkMobile">
				<span style="float:left;width:80px;display:inline-block">确认电话：</span>
				<input type="text" name="mobile" id="dealExcel_mobile"> 
				<input type="button"  onclick="checkMobile()" value="确认身份">
				</div>
				<div style="display:none" id="dealExcle_originInfo">
				<input id="dealExcel_originId" name="dealExcel_originId" type="hidden">
				<table>
					<tr>
						<td height="30" style="width:80px;font-size:14px" >电话：</td>
						<td style="width:80px;font-size:14px" id="dealExcel_telphone"></td>
					</tr>
					<tr>
						<td height="30" style="width:80px;font-size:14px">网点名称：</td>
						<td style="width:80px;font-size:14px" id="dealExcel_originName"></td>
					</tr>
					<tr>
						<td height="30" style="width:80px;font-size:14px">负责人：</td>
						<td style="width:80px;font-size:14px" id="dealExcel_principalName"> </td>
					</tr>
					<tr>
						<td height="30" style="width:80px;font-size:14px">快递公司:</td>
						<td style="width:80px;font-size:14px" id="dealExcel_companyName"></td>
					</tr>
				</table>
				
				</div>
				
				<div style="display:none" id="dealExcel_inportExcel">
				<table>
					<tr>
					<td ></td>
					</tr>
					<tr  height="30" style="width:80px;font-size:14px">
					<td>导入订单详情表:</td>
					</tr>
					<tr>
						
						<td ><input height="30" type="file" name="uploadify" id="uploadify" /> <input id="filePath" type="text" name="exclePath" />
					</tr>
					<tr>
						<td colspan="2">
							<div id="imgpath"></div>
						</td>
					</tr>
				</table>
				</div>
			</div>
			<div class="formBar">
				<ul>
					<li>
						<div class="buttonActive">
							<div class="buttonContent">
								<button type="submit">保存</button>
							</div>
						</div>
					</li>
					<li>
						<div class="button">
							<div class="buttonContent">
								<button type="button" class="close">取消</button>
							</div>
						</div>
					</li>
				</ul>
			</div>
		</form>
	</div>
</body>
</html>